#include "stdafx.h"
#include "Tests.h"

TEST_F(TestWMReaderUtils, EmptyFileTime)
{
    FILETIME time;
    memset(&time, 0, sizeof(time));

    QString timeString = "";

    WMReaderUtils::FileTimeToQString(time, timeString);
    EXPECT_EQ("Not Available", timeString.toStdString());
}

TEST_F(TestWMReaderUtils, NotValidFileTime)
{
    FILETIME time;
    memset(&time, 0xFF, sizeof(time));

    QString timeString = "";
    
    WMReaderUtils::FileTimeToQString(time, timeString);
    EXPECT_EQ("Not Available", timeString.toStdString());
}

TEST_F(TestWMReaderUtils, MinutesLessThanTen)
{
    FILETIME time;
    time.dwHighDateTime = 29850052;
    time.dwLowDateTime = 2876100608;

    QString timeString = "";

    WMReaderUtils::FileTimeToQString(time, timeString);
    EXPECT_EQ("8/4/2007 10:00", timeString.toStdString());
}

TEST_F(TestWMReaderUtils, MinutesMoreThanTen)
{
    FILETIME time;
    time.dwHighDateTime = 30144888;
    time.dwLowDateTime = 3278417152;

    QString timeString = "";

    WMReaderUtils::FileTimeToQString(time, timeString);
    EXPECT_EQ("13/4/2011 1:18", timeString.toStdString());
}

int main(int argc, char *argv[])
{
    ::testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}